﻿using B.S.DataBase.MyProject.ErrorCode;
using B.S.DataBase.Write.API.Appicant.Command.MeonCommand;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.DataBase.Write.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TMeonController : ControllerBase
    {
        private readonly IMediator mediator;

        public TMeonController(IMediator mediator)
        {
            this.mediator = mediator;
        }


        /// <summary>
        /// 添加审批信息
        /// </summary>
        /// <param name="add"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> TMeonAdd(AddMeonCommand add)
        {
            return  await mediator.Send(add);
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="commder"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<APIResult<object>> DleteTMeon([FromQuery]MeondeleteCommder commder)
        {
            return await mediator.Send(commder);
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="meon"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<APIResult<string>> UPdateTM(MeonUpdateCommder meon)
        {
            return await mediator.Send(meon);
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="update"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<APIResult<object>> UpdateToen(UpdateTounCommder update)
        {
            return await mediator.Send(update);
        }
    }
}
